package com.crazy.shell.config.linstener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * 环境监听
 * Created by creazier.huang on 16/9/30.
 */
public class EnvPreListener implements ApplicationListener<ApplicationEnvironmentPreparedEvent>{

    private  final Logger logger = LoggerFactory.getLogger(EnvPreListener.class);


    @Override
    public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
        ConfigurableEnvironment env = event.getEnvironment();
        SpringApplication app = event.getSpringApplication();
//        app.setBannerMode(Banner.Mode.OFF);
        logger.info("EnvPreListener order : {0}",env);
    }
}
